﻿using ED.Furion.Config;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using System.Text.Json;

namespace ED.Furion
{
	public static  class FurionExtensions
	{
		// 配置入口

		public static IServiceCollection AddFurion(this IServiceCollection services, Action<FurionConfig>? setupAction = null)
		{
			if (setupAction != null) {
				ConfigureFurion(services, setupAction);
			}
			// 注入Furion
			services.AddInject();
			return services;
		}

		public static void ConfigureFurion(this IServiceCollection services, Action<FurionConfig> setupAction)
		{
			services.Configure(setupAction);

		}

		public static void AddFurionApp(this WebApplication app, string swaggerRootPath) 
		{
			app.UseInject(swaggerRootPath);
		}
	}
}